﻿<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Graph</title>
	<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>

<body>
	<div id="mainWrapper">
	<div id="graph">
		<form method="post">
		<table>
			<tr>
				<td> Ngày <input type="text" name="ngay"/></td>
			</tr>
			<tr>
				<td> Tháng <input type="text" name="thang"/></td>
			</tr>
			<tr>
				<td> Năm <input type="text" name="nam"/></td>
			</tr>
			<tr>
				<td><input type="submit" name="submit" id="submit" value="Select"/></td>
			</tr>
		</table>
		<br /> <br />
			<?php
			$out='Biểu đồ số lượng hàng hóa bán ra trong tuần ';
			echo $out;
			?>
		</form>
		<br /></br /><br />
</body>
<?php
$conn=mysql_connect('localhost','root','') or die(mysql_error());
	mysql_select_db('thuctap');
		if(isset($_POST['submit']))
		/*$ngay = $_POST["ngay"];
		$thang = $_POST["thang"];
		$nam = $_POST["nam"];
		$date = $nam."-".$thang."-".$ngay;*/
		
		$fetch=mysql_query("select MASP, sum(SLBAN) from chitietban
				where MAHDB in( 
				select id
							from hoadonban
							where week(NGAYBAN)=week('".$_POST['nam']."-".$_POST['thang']."-".$_POST['ngay']."')
							and year(NGAYBAN)=".$_POST['nam'].")
				group by MASP");// or die(mysql_error);
		
		while($rows=mysql_fetch_array($fetch))
		{
			$name=$rows['MASP'];
			$height1=$rows['sum(SLBAN)'];
			$ratings=$height1;
			$output='<td><li id="s">'.$name.'</li></td>';
			$output = '<li>
				<br />
				'.$ratings.'
				<br />
				<img src="Capture.png" height="' .$height1.'"width="18" alt="" />
				<br />
				SP'.$name. '
				</li>';
			echo $output;
		}
		echo '</tr></table>';
?>